'''
为适应由计数转变为计时，每个模块的处理函数都应该进行重写
这里仅仅重写测试时使用了的模块
'''

from feature_extractor_improve import ProcessModule

class ThresholdCounterModule(ProcessModule):
    """求超过指定阈值的个数"""

    FEATURE_NAME = "ThresholdCounter"
    UPPER_THRESHOLD = 1.10
    LOWER_THRESHOLD = 0.70

    def processFullQueue(self):
        count = 0
        for value in self.queue.queue:
            #仅在次数将value改为value['volt']
            if value['volt'] > self.UPPER_THRESHOLD or value['volt'] < self.LOWER_THRESHOLD:
                count = count + 1
        return count